home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 April: Mac OS SDK / Dev.CD Apr 96 SDK / Dev.CD Apr 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc Development Framework / ODFDev / ODF / Examples / Clock / Include / ClockFra.h < prev    next >
Encoding:
Text File  |  1995-11-08  |  3.4 KB  |  117 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                ClockFra.h
  4. //    Release Version:    $ 1.0d11 $
  5. //
  6. //    Author:                Lonnie Millett
  7. //
  8. //    Copyright:    © 1993, 1995 by Apple Computer, Inc., all rights reserved.
  9. //
  10. //========================================================================================
  11.  
  12. #ifndef CLOCKFRA_H
  13. #define CLOCKFRA_H
  14.  
  15. // ----- Framework Includes -----
  16.  
  17. #ifndef FWFRAME_H
  18. #include "FWFrame.h"
  19. #endif
  20.  
  21. // ----- Foundation Includes -----
  22.  
  23. #ifndef FWSTRING_H
  24. #include "FWString.h"
  25. #endif
  26.  
  27. // ----- Graphic Includes -----
  28.  
  29. #ifndef FWRECT_H
  30. #include "FWRect.h"
  31. #endif
  32.  
  33. #ifndef FWMAPING_H
  34. #include "FWMaping.h"
  35. #endif
  36.  
  37. //========================================================================================
  38. // Classes defined in this interface
  39. //========================================================================================
  40.  
  41. class FW_CLASS_ATTR CClockFrame;
  42.  
  43. //========================================================================================
  44. // Classes used by this interface
  45. //========================================================================================
  46.  
  47. #if FW_LIB_EXPORT_PRAGMAS
  48. #pragma import on
  49. #endif
  50. class FW_CLASS_ATTR ODFrame;
  51. class FW_CLASS_ATTR ODShape;
  52. class FW_CLASS_ATTR ODFacet;
  53. class FW_CLASS_ATTR FW_CTime;
  54. #if FW_LIB_EXPORT_PRAGMAS
  55. #pragma import off
  56. #endif
  57.  
  58. class FW_CLASS_ATTR CClockPart;
  59.  
  60. //========================================================================================
  61. // CClockFrame
  62. //========================================================================================
  63.  
  64. class FW_CLASS_ATTR CClockFrame : public FW_CFrame
  65. {
  66. public:
  67.  
  68.     FW_DECLARE_CLASS
  69. //----------------------------------------------------------------------------------------
  70. //    Constructor/Destructor
  71. //
  72. public:
  73.     CClockFrame(Environment* ev, ODFrame* odFrame, FW_CPresentation* presentation, CClockPart* clockPart);
  74.     virtual ~ CClockFrame();
  75.  
  76. //----------------------------------------------------------------------------------------
  77. //    Inherited API
  78. //
  79. public:
  80.     virtual void         FacetAdded(Environment* ev, ODFacet* facet);
  81.     virtual void         FrameShapeChanged(Environment* ev);    
  82.     virtual void         Draw(Environment* ev, ODFacet* odFacet, ODShape* invalidShape);    
  83.     virtual ODShape*    AdjustUsedShape(Environment* ev, ODShape* suggestedUsedShape);
  84.     virtual ODShape*    AdjustActiveShape(Environment* ev, ODFacet* facet, ODShape* suggestedActiveShape);
  85.  
  86. //----------------------------------------------------------------------------------------
  87. //    New API
  88. //
  89. public:
  90.     void                 UpdateAnalogClock(Environment* ev, FW_CFacetContext& fc, const FW_CTime& time);
  91.     void                 UpdateDigitalClock(Environment* ev, FW_CFacetContext& fc, const FW_CTime& time);
  92.  
  93.     void                 UpdateClock(Environment* ev, const FW_CTime& time);
  94.  
  95.     void                ChangeClockType(Environment* ev, short newClockType);
  96.     
  97. private:
  98.     void                 DrawClockFace(Environment* ev, FW_CFacetContext& fc);
  99.     void                 DrawHourHand(Environment* ev, FW_CFacetContext& fc, FW_CFixed hour, FW_CFixed minute);
  100.     void                 DrawMinuteHand(Environment* ev, FW_CFacetContext& fc, FW_CFixed minute);
  101.     void                 DrawSecondHand(Environment* ev, FW_CFacetContext& fc, FW_CFixed second);
  102.  
  103.     void                ResetMapping(Environment* ev);
  104.     
  105. //----------------------------------------------------------------------------------------
  106. //    Data Members
  107. //
  108. private:
  109.     CClockPart*         fClockPart;
  110.     FW_CRect             fDigitalClockRect;
  111.     FW_CString32         fFaceString;
  112.     FW_CMapping            fMapping;
  113.     FW_CRect            fAnalogUsedRect;
  114. };
  115.  
  116. #endif
  117.